﻿using System;

namespace MyLib.IO {
	/// <summary>
	/// 
	/// </summary>
	interface IFileSystemProvider {
		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileType"></param>
		/// <param name="objectId"></param>
		/// <returns></returns>
		int DeleteAllFileObject(int fileType, string objectId);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileType"></param>
		/// <param name="objectId"></param>
		/// <param name="fileName"></param>
		/// <param name="parentId"></param>
		/// <returns></returns>
		int DeleteFileObject(int fileType, string objectId, string fileName, string parentId = null);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileId"></param>
		/// <returns></returns>
		int DeleteFileObject(string fileId);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileType"></param>
		/// <param name="objectId"></param>
		/// <param name="fileName"></param>
		/// <param name="parentId"></param>
		/// <returns></returns>
		FileObject GetFileObject(int fileType, string objectId, string fileName, string parentId = null);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileId"></param>
		/// <returns></returns>
		FileObject GetFileObject(string fileId);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileId"></param>
		/// <returns></returns>
		byte[] GetFileObjectContent(string fileId);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileType"></param>
		/// <param name="objectId"></param>
		/// <param name="parentId"></param>
		/// <param name="attr"></param>
		/// <returns></returns>
		System.Collections.Generic.IEnumerable<FileObject> GetFileObjects(int fileType, string objectId, string parentId = null, FileObjectAttr attr = FileObjectAttr.None | FileObjectAttr.ReadOnly | FileObjectAttr.SubDirectory);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="srcFileType"></param>
		/// <param name="srcObjectId"></param>
		/// <param name="dstFileType"></param>
		/// <param name="dstObjectId"></param>
		/// <returns></returns>
		int MoveFileObjects(int srcFileType, string srcObjectId, int dstFileType, string dstObjectId);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileType"></param>
		/// <param name="objectId"></param>
		/// <param name="fileName"></param>
		/// <param name="content"></param>
		/// <param name="lastWriteTime"></param>
		/// <param name="description"></param>
		/// <param name="summary"></param>
		/// <param name="parentId"></param>
		/// <param name="attr"></param>
		/// <returns></returns>
		int SetFileObject(int fileType, string objectId, string fileName, byte[] content, DateTime lastWriteTime, string description = "", string summary = "", string parentId = null, FileObjectAttr attr = FileObjectAttr.None);
	} // end of IFileSystemProvider.
}
